//
//  ThreePicturesTableViewCell.m
//  SnailPost
//
//  Created by Q on 16/3/12.
//  Copyright © 2016年 抠泥ser. All rights reserved.
//

#import "ThreePicturesTableViewCell.h"
#import <Masonry.h>
#define CHEIGHT self.contentView.frame.size.height
#define CWIDTH self.contentView.frame.size.width

@implementation ThreePicturesTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.sv = [[UIView alloc] init];
        [_sv NightWithType:UIViewColorTypeNormal];
        [self.contentView addSubview:_sv];
        
        self.titleLabel = [[UILabel alloc] init];
        // _titleLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleLabel];
        
        self.imgsrcImageView = [[UIImageView alloc] init];
        // _imgsrcImageView.backgroundColor =[UIColor grayColor];
        [self.contentView addSubview:_imgsrcImageView];
        
        self.leftImgsrcImageView = [[UIImageView alloc] init];
        // _leftImgsrcImageView.backgroundColor =[UIColor purpleColor];
        [self.contentView addSubview:_leftImgsrcImageView];
        
        self.rightImgsrcImageView = [[UIImageView alloc] init];
        // _rightImgsrcImageView.backgroundColor =[UIColor blueColor];
        [self.contentView addSubview:_rightImgsrcImageView];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    // Mansonry适配
    [_sv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_sv).with.insets(UIEdgeInsetsMake(10, 10, CHEIGHT / 5 * 4, 10));
    }];
    [_leftImgsrcImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_sv).with.insets(UIEdgeInsetsMake(10 + CHEIGHT / 5, 10, 10, (CWIDTH - 20 - 10) / 3 * 2 + 10 + 5 + 5));
    }];
    [_imgsrcImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_sv).with.insets(UIEdgeInsetsMake(10 + CHEIGHT / 5, (CWIDTH - 20 - 10) / 3 + 10 + 5, 10, (CWIDTH - 20 - 10) / 3 + 10 + 5));
    }];
    [_rightImgsrcImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_sv).with.insets(UIEdgeInsetsMake(10 + CHEIGHT / 5, (CWIDTH - 20 - 10) / 3 * 2 + 10 + 5 + 5, 10, 10));
    }];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
